﻿
@model EmailIM

@{
    SIG.DAL.Dapper.Model.PageMeta pm = (SIG.DAL.Dapper.Model.PageMeta)ViewBag.PageMeta;

    ViewBag.Title = pm != null ? pm.Title : "联系我们";
}

@section header{
    @if (pm != null)
    {
        <meta name="keywords" content="@pm.Keyword" />
        <meta name="description" content="@pm.Description" />
    }
<link href="~/plugins/toastr/toastr.min.css" rel="stylesheet" />
}

<div class="banner" id="map_canvas" style="height:400px;">
</div>

    <section class="container contact-page m-b-50">
     
            <div class="row">
                <div class="col-xs-8 animated fadeInLeft sendform">
                    <header class="box-header">
                        <h3 class="title_3">
                            联系我们
                        </h3>
                        <p>如有什么需要，可以填写表单咨询我们，或拨打右边的联系电话，我们会尽快回复您</p>
                    </header>



                    <div id="loader" class="alert alert-block" style="display:none">
                        <i class="fa fa-spinner fa-spin"></i> 发送中...
                    </div>

                    <div class="send_email">
                        @using (Ajax.BeginForm("SendEmail", null, new AjaxOptions
                        {

                            HttpMethod = "POST",
                            OnBegin = "onBeginSave",
                            OnComplete = "onCompleteSave",
                            OnSuccess = "updateSuccess"

                        }, new { role = "form" }))
                        {
                            @Html.AntiForgeryToken()
                            @Html.ValidationSummary(true)
                            <div class="form-group">
                                @Html.TextBoxFor(m => m.Name, new { @class = "form-control", placeholder = "姓名" })
                                @Html.ValidationMessageFor(model => model.Name)
                            </div>
                            <div class="form-group">
                                @Html.TextBoxFor(m => m.Email, new { @class = "form-control", placeholder = "工作邮箱" })
                                @Html.ValidationMessageFor(model => model.Email)
                            </div>
                            <div class="form-group">
                                @Html.TextBoxFor(m => m.Phone, new { @class = "form-control", placeholder = "联系电话" })
                                @Html.ValidationMessageFor(model => model.Phone)
                            </div>
                            <div class="form-group">
                                @Html.TextAreaFor(m => m.Body, new { @class = "form-control", placeholder = "内容", rows = "6" })
                            </div>
                            <p>
                                <button type="submit" id="btnSave" class="btn btn-red btn-md">马上发送</button>
                            </p>
                        }

                    </div>

                </div>
                <div class="col-xs-4">
                    <div class="contactus">
                        <h3 class="title_3">
                            @SettingsManager.Contact.CompanyName
                        </h3>

                       
                        <ul class="list">
                            <li>地址: @SettingsManager.Contact.Address</li>
                            <li>电话: @SettingsManager.Contact.Mobile</li>
                            <li>联系人: @SettingsManager.Contact.ContactMan</li>

                            <li>邮箱: <a href="mailto:@SettingsManager.Contact.MailTo">@SettingsManager.Contact.MailTo</a></li>
                            <li>
                                业务QQ: <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=@SettingsManager.Social.Oicq&site=尚橙&menu=yes">@SettingsManager.Social.Oicq</a>
                            </li>
                           
                        </ul>
                        <div class="qrcode">
                            <p class="text-center"><img src="@SettingsManager.Social.WeiXingCode" alt="@SettingsManager.Social.WeiXing" style="width:150px;" /></p>
                            <p class="text-center">微信扫一扫，关注我</p>
                        </div>
                    </div>
                </div>
            </div>
      
    </section>

@section footer{

    <script language="javascript" src="http://api.map.baidu.com/api?v=2.0&ak=G7h0sKsr60IFU3OrHRmKTRzD"></script>
@Scripts.Render("~/bundles/jqueryvalWithBootstrap")
<script src="~/plugins/toastr/toastr.min.js"></script>
<script>

    function onBeginSave() {
        $("#btnSave").text("发送中...");
    }
    function onCompleteSave() {
        $("#btnSave").text("马上发送");
    }

    function updateSuccess(data) {
        var title = '@ViewBag.Title';
      //  Common.ShowBox(data.Status, data.Message, title);

        switch (data.Status) {
            case 1:
                toastr.success(data.Message, title)
                break;
            case 2:
                toastr.error(data.Message, title)
                break;
            case 3:
                toastr.info(data.Message, title)
                break;
            case 4:
                toastr.warning(data.Message, title)
        }
    }
   
</script>

<script language="javascript">


    // 百度地图API功能
    var map = new BMap.Map("map_canvas");
       //坐标
        var vPoint = "@SettingsManager.Contact.Coordinate";
        var points = vPoint.split(',');


    map.addControl(new BMap.NavigationControl());
    map.enableScrollWheelZoom();    //启用滚轮放大缩小，默认禁用
    map.enableContinuousZoom();    //启用地图惯性拖拽，默认禁用

    map.centerAndZoom(new BMap.Point(points[0], points[1]), 16);
    var point = new BMap.Point(points[0], points[1]);

   // var myIcon = new BMap.Icon("/Content/Desktop/img/marker.png", new BMap.Size(132, 132));
   // var marker1 = new BMap.Marker(point, { icon: myIcon });  // 创建标注
    var marker1 = new BMap.Marker(point);

    map.addOverlay(marker1);              // 将标注添加到地图中
   // marker1.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
    var sContent =
"<h4 style='margin:0 0 5px 0;padding:0.2em 0'>@SettingsManager.Contact.CompanyName</h4>" +
"<p>地址：@SettingsManager.Contact.Address <br/>" +
"电话：@SettingsManager.Contact.Phone</p>" +
"</div>";


    //创建信息窗口
    var infoWindow1 = new BMap.InfoWindow(sContent);
    marker1.addEventListener("click", function () { this.openInfoWindow(infoWindow1); });

   // marker1.openInfoWindow(infoWindow1);
 //   changeMapStyle('grayscale')
  //  sel.value = 'grayscale';

    function changeMapStyle(style) {
        map.setMapStyle({ style: style });
        //$('#desc').html(mapstyles[style].desc);
    }

        $(function () {
            //当前菜单
            $("#nav li").removeClass("active").eq(4).addClass("active");
        })



    </script>

}